package com.healer.controller;

import com.healer.pojo.User;
import io.swagger.annotations.*;
import io.swagger.models.auth.In;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@Api(tags = "我正在进行Swagger的学习")
public class SwaggerController {

    @PostMapping("/hello-swagger")
    @ResponseBody
    @ApiOperation(value = "这里是测试swagger的接口测试功能的")
    public User  helloSwagger(@ApiParam("我是来自前端的用户信息") @RequestBody Map<String, Object> map) {
        User user = new User(Integer.parseInt(map.get("id").toString()), map.get("name").toString(), Integer.parseInt(map.get("age").toString()));
        return user;
    }

    @GetMapping({"/", "/index"})
    @ApiOperation(value = "我是主页哦")
    public String index() {
     return "index";
    }
}
